package com.tm.mholmu.db;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.tm.mholmu.application.Util;

public class Outfits { 
	int id;
	Outfit head;
	Outfit body;
	Outfit hand;
	Outfit waist;
	Outfit foot;
	Outfit stone;
	String s;
	int[] i;
	List<SkillBar>lsb = new ArrayList<SkillBar>();
	
	public Outfits(Outfit head, Outfit body, Outfit hand, Outfit waist,
			Outfit foot, Outfit stone) {
		super();
		this.head = head;
		this.body = body;
		this.hand = hand;
		this.waist = waist;
		this.foot = foot;
		this.stone = stone;
		i=toint();
		
		intiSkillBar();
		Collections.sort(this.lsb,new SkillComparator());
	}

	public int[] toint() {
		s = "";
		s = head.skill + body.skill + hand.skill + waist.skill + foot.skill
				+ stone.skill;
		return Util.StringToInt(s);
	}
	
	public void intiSkillBar() {
		SkillBar sb;
		for (int j = 0; j < i.length; j++) {
		sb=new SkillBar();
		sb.name=DBUtils.getInstance().getDBService().getSkill_Name(i[j]);
		sb.skill=i[j];
		sb.body=body.get(i[j]);
		sb.head=head.get(i[j]);
		sb.hand=hand.get(i[j]);
		sb.waist=waist.get(i[j]);
		sb.foot=foot.get(i[j]);
		sb.stone=stone.get(i[j]);
		lsb.add(sb);
		}
		
		
		
	}
}
